package cn.yzhg.lib.tools

import android.widget.Toast
import android.widget.Toast.makeText
import cn.yzhg.lib.tools.KotlinTools

/**
 * 类 名: ToastTools
 * 作 者: yzhg
 * 创 建: 2018/11/8 0008
 * 版 本: 1.0
 * 历 史: (版本) 作者 时间 注释
 * 描 述:  private constructor() 私有化构造
 */
class ToastTools private constructor() {

    companion object {
        private var toast: Toast? = null

        fun showToast(resMsg: Int) {
            if (toast == null) toast = makeText(KotlinTools.getContext(), resMsg, Toast.LENGTH_LONG)
            toast!!.setText(resMsg)
            toast!!.show()
        }


        fun showToast(msg: String) {
            if (toast == null) toast = makeText(KotlinTools.getContext(), msg, Toast.LENGTH_LONG)
            toast!!.setText(msg)
            toast!!.show()
        }
    }


}